package com.michael.study.component.fragment

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.michael.study.component.R
import com.michael.study.library.utils.Actions
import kotlinx.android.synthetic.main.activity_fragment_demo.*

class FragmentDemoActivity : AppCompatActivity(), View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_fragment_demo)

        btn_fragment.setOnClickListener(this)
        btn_viewpager.setOnClickListener(this)
        Thread {
            btn_fragment.setText("Fragment")

        }.start()
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.btn_fragment -> {
                Actions.startActivity(this, FragmentActivity::class.java)
            }

            R.id.btn_viewpager -> {
                Actions.startActivity(this, ViewPagerActivity::class.java)
            }
        }
    }
}